﻿
namespace BEGDC.PreContract.DAL
{
    using System;
    using System.Collections.Generic;
    using Castle.ActiveRecord;
    using NHibernate.Expression;


    [ActiveRecord]
    public partial class DicItem : ActiveRecordBase<DicItem>
    {
		#region Const Definition
		
		public const string CONST_DicItemID								= "DicItemID";
		public const string CONST_DicTypeID								= "DicTypeID";
		public const string CONST_DicItemValue							= "DicItemValue";
		public const string CONST_DicItemDesc							= "DicItemDesc";
		public const string CONST_IsEnabled								= "IsEnabled";

		#endregion
		
        #region Member Variables
        // Primary Key
        private System.Int32 _dicItemID;
        
        // Non Key
        private System.String _dicItemValue;
        private System.String _dicItemDesc;
        private System.Boolean _isEnabled;

        // Parents
        private DicType _dicTypeID;
        
        
		

        #endregion

        public DicItem() {
               
        }
        public DicItem(
            System.String dicItemValue
            ,System.String dicItemDesc
            ,System.Boolean isEnabled) : this() {
                
            this._dicItemValue = dicItemValue; 
            this._dicItemDesc = dicItemDesc; 
            this._isEnabled = isEnabled; 
        }
        
        #region Properties
        // Primary Key        
		
		#if (SQLServer)
        [PrimaryKey]
		#else
		[PrimaryKey(PrimaryKeyType.Native, SequenceName = "SEQ_DICITEM_DICITEMID")]
		#endif
        public System.Int32 DicItemID {
            get { return this._dicItemID; }
            set {  this._dicItemID = value; }
        }
        
        // Non Key
        [Property]
        public System.String DicItemValue {
            get { return this._dicItemValue; }
			set { if (value == null) return; if (value.Length > 100) this._dicItemValue = value.Substring(0,100); else this._dicItemValue = value; }	
        }
        
        [Property]
        public System.String DicItemDesc {
            get { return this._dicItemDesc; }
			set { if (value == null) return; if (value.Length > 100) this._dicItemDesc = value.Substring(0,100); else this._dicItemDesc = value; }	
        }
        
        [Property]
        public System.Boolean IsEnabled {
            get { return this._isEnabled; }
			set { this._isEnabled = value; }
        }
        
        
        // Parent Relationships
        [BelongsTo("DicTypeID")]
        public DicType DicTypeID {
            get { return this._dicTypeID; }
            set { this._dicTypeID = value; }
        }
        
        // Child Relationships
        
		
        #endregion
		
		// Clone
		public DicItem Clone()
		{
			DicItem newDicItem = new DicItem();
			
            newDicItem.DicItemValue = this._dicItemValue; 
            newDicItem.DicItemDesc = this._dicItemDesc; 
            newDicItem.IsEnabled = this._isEnabled; 
            newDicItem.DicTypeID = this._dicTypeID ; 
			return newDicItem;
		}
    }
}



